﻿using Digitalmes.Infrastructure;

namespace Digitalmes.Gallery;

public static class ServiceCollectionExtensions
{
    /// <summary>
    /// 配置应用程序应用相关服务。
    /// </summary>
    /// <param name="builder"></param>
    public static IHostBuilder ConfigureStartup(this IHostBuilder builder)
    {
        builder.AddScada(); // SCADA 服务

        return builder.ConfigureServices((context, services) =>
        {
            // 注册菜单服务
            services.AddSingleton<INavigationViewService, NavigationViewService>();

            services.AddInfrastructureSteup(context.Configuration);
            // 注册服务

            // 注册页面以及 VieModel
            services.AddSingleton<DashboardPage>();
            services.AddSingleton<DashboardViewModel>();
            services.AddSingleton<SettingsPage>();
            services.AddSingleton<SettingsViewModel>();

            services.AddSingleton<LedCtlPage>();
            services.AddSingleton<LedCtlViewModel>();
            services.AddSingleton<RectCtlPage>();
            services.AddSingleton<RectCtlViewModel>();
            services.AddSingleton<WebViewPage>();
            services.AddSingleton<WebViewViewModel>();
        });
    }
}
